import Vue from 'vue'//入口文件
import VueRouter from 'vue-router'//1.1导入路由的包
import FastClick from 'fastclick'//安装fastclick
import {indicator} from './base/js/toast.js'//加载指示器


//导入自己配置的stylus
import './common/less/index.less'

//调用fastclick
FastClick.attach(document.body)

//移动端调试工具
// import VConsole from 'vconsole'
// var vConsole = new VConsole()

//导入axios
import Axios from 'axios'
Vue.prototype.$ajax = Axios//挂载原型
// Axios.defaults.baseURL = "http://192.168.169.149:5003/"     //设置默认地址//公司
Axios.defaults.baseURL = "http://koa.kgm0515.top/api/hs"     		//设置默认地址//阿里云服务器
Axios.headers = {'X-Requested-With': 'XMLHttpRequest'}

//http interceptor: 拦截器,显示loading图标======================
Axios.interceptors.request.use(function(config){	//请求发起之前,显示
	indicator(1)
	return config
});
Axios.interceptors.response.use(function(config){	//请求发起之前，隐藏
	setTimeout(()=>{
		indicator()
	},100)
	return config
});


//安装图片懒加载
import VueLazyLoad from 'vue-lazyload'		
Vue.use(VueLazyLoad, {
	loading: require('./common/image/default.png'),
})

//定义时间全局过滤器
import moment from 'moment'
Vue.filter('formatDate', function(data, formatString){
	formatString = formatString || 'YYYY-MM-DD hh:mm'
	return moment(data).format(formatString)
})

//导入vuex对象仓库
import store from './store.js'

//1.2安装路由
Vue.use(VueRouter)
import router from './router.js'//导入自己的router.js路由模块
import app from './App.vue'//导入App根组件

//创建vue实例
var vm = new Vue({
	el: '#app',
	render: c => c(app),    //渲染app页面到index.html首页
	router,                 //挂载自己的路由对象
	store,					//挂载vuex
})